package com.junmoo.www.config.kafka;//package com.junmo.emqx.kafka;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/kf")
public class KafkaController {
    @Autowired
    KafkaProducer kafkaProducer;

    @PostMapping(value = "s1")
    public String sendMsg(String message) {
        kafkaProducer.send("测试消息", s -> {
            log.info("-----消息发送成功");
        }, e -> {
            log.info("-----消息发送失败   ");
        });
        return"success";
    }
}
